--[[/**
-- * 
 死亡前触发,把存储起来的治疗量消耗掉
-- *
-- */]]

---@class BuffEffect546101 : BaseBuffEffect
BuffEffect546101 = ClientFight.CreateClass("BuffEffect546101", ClientFight.BaseBuffEffect)
local t = BuffEffect546101

---@param fight Fight
---@param buff FighterBuff
function t:action(fight, buff, ...)
    local target = buff.target;
    local save = target.parametersByObject[BuffEffect546100.BUFF_EFFECT_546100_HP] or 0;
    if (save < 1) then
        SkillRoleMgr.savePathFile(string.format("[%s][EFFECT]Fighter %s  Buff%s 当前储存治疗量0 , 在死亡前转化为生命失败",
                fight.frame, buff.target.fighterId, buff.modelId
        ));
        return IBuffEffect.FAIL;
    end
    target.parametersByObject[BuffEffect546100.BUFF_EFFECT_546100_HP] = 0;
    DamageManager.setFighterHp(fight, target, target, nil, 0, save, target.hp + save, false, false, false, false);
    local logSave = save;
    SkillRoleMgr.savePathFile(string.format("[%s][EFFECT]Fighter %s  Buff%s 当前储存治疗量%s , 在死亡前转化为生命",
            fight.frame, buff.target.fighterId, buff.modelId, logSave
    ));
    return ClientFight.BaseBuffEffect.action(self, fight, buff, ...);
end

t.New()